package com.java01.misc.exec;

import java.io.IOException;

public class ShutdownHookTest {

	public static void main(String[] args) {
		Runtime.getRuntime().addShutdownHook(new Thread() {
			@Override
			public void run() {
				try {
					Runtime.getRuntime().exec("calc");
					System.out.println("do something after shutdown");
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		});

		try {
			Thread.sleep(3000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
}
